microbit = codesters.Microbit()
microbit.show_string("hello")
data = microbit.get_temp()
microbit.show_number(data)
data_list = []
time_list = []
my_display = codesters.ScatterPlot(time_list, data_list)
try:
tval1 = my_var
except:
tval1 = "DNE"
try:
tval2 = time
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval2 != "DNE" and tval1 == "DNE", "Great job!")
t1.add_failure(tval2 == "DNE" and tval1 != "DNE", "Did you rename the variable my_var to time?")
t1.add_failure(tval2 == "DNE" and tval1 == "DNE", "Did you drag in Integer Variable?")
t2 = TestObjective()
t2.add_success(tval2 == 0, "Great job!")
t2.add_failure(tval2 == 25, "Did you change the number to right of the = sign to 0?")
t2.add_failure(tval2 == "DNE", "Did you drag in Integer Variable and rename it time?")
t2.add_failure(tval2 != 0, "Oops! Make sure the value to the left of the = sign is 0!")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)